FROM centos:8

# install necessary tools
RUN yum install unzip -y
RUN yum install python38 -y
# RUN yum install pip3 -y


# install headless chrome
RUN mkdir -p /root/project/chrome && cd /root/project/chrome

# 安装chromedriver
RUN curl -O https://chromedriver.storage.googleapis.com/96.0.4664.45/chromedriver_linux64.zip && unzip  chromedriver_linux64.zip -d /usr/bin
RUN curl -O https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm && yum install google-chrome-stable_current_x86_64.rpm -y

WORKDIR /app

COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

COPY . .
EXPOSE 80
ENV FLASK_ENV=prd

RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone

ENTRYPOINT [ "python3" ]
CMD [ "app.py" ]
